/*
 * @Author: your name
 * @Date: 2022-04-20 14:56:05
 * @LastEditTime: 2022-12-29 10:46:57
 * @LastEditors: shiguo
 * @Description: 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 * @FilePath: /@aks-dev/easyui/lib/RefreshList/index.ts
 */

import * as React from 'react'

import { FlatListProps, SectionListProps } from 'react-native'
import { IPropsSwipeListView } from 'react-native-swipe-list-view/types'


// declare namespace easyui {
//     type Mode = {
//         FlatList
//         SectionList
//         SwipeList
//     }
// }



type CommonProps = {
    // mode: keyof easyui.Mode;
    onHeaderRefresh: (info: any) => void;
    onFooterRefresh: (info: any) => void;
    reload: () => void;
    refreshState: RefreshState;
    renderListEmptyComponent: () => React.ReactElement;
}


type SectionT = {
    [key: string]: any;
};
type ItemT = any;


export type FlatListRefreshProps = {
    mode?: 'FlatList';
} & FlatListProps<ItemT> & Partial<CommonProps>;


export type SectionListRefreshProps = {
    mode: 'SectionList';

} & SectionListProps<ItemT, SectionT> & Partial<CommonProps>;

export type SwipeListViewRefreshProps = {
    mode: 'SwipeList';
    data: ItemT[];
} & IPropsSwipeListView<ItemT> & Partial<CommonProps> &  FlatListProps<ItemT> ;

export type RefreshListProps = FlatListRefreshProps | SwipeListViewRefreshProps | SectionListRefreshProps


export enum RefreshState {
    Idle = 'Idle',
    HeaderRefreshing = 'HeaderRefreshing',
    FooterRefreshing = 'FooterRefreshing',
    NoMoreData = 'NoMoreData',
    Failure = 'Failure',
    EmptyData = 'EmptyData',
    None = 'None',
}


export const RefreshText = {
    HeaderRefreshing: '上拉可以刷新',
    FooterRefreshing: '下拉可以加载更多',
    Failure: '服务器正在出小差，点击重新加载',
    NoMoreData: '已经全部加载完毕',
    EmptyData: '没有数据',
    Idle: '正在加载更多的数据..',
}




export declare const RefreshList: React.FC<RefreshListProps>;

